package com.xuetang9.demo.ssm.domain.validation;

import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import com.xuetang9.demo.ssm.domain.Resource;

@Component
public class ResourceSaveValidation {

	/*@Override
	public boolean supports(Class<?> clazz) {
		
		return Resource.class.isAssignableFrom(clazz);
	}

	@Override
	public void validate(Object target, Errors errors) {
		Resource res = (Resource)target;
		
		if(res.getName() == null || res.getName().trim().length() == 0) {
			errors.reject("name", "资源名称必填");
		}
		
		ValidationUtils.rejectIfEmpty(errors, "pid", "pid.required","父资源编号必填");
	}
*/
}
